package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.domain.ZhwyChargeitem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ZhwyChargedataMapper;
import com.ruoyi.system.domain.ZhwyChargedata;
import com.ruoyi.system.service.IZhwyChargedataService;

/**
 * 收费数据生成Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-05-09
 */
@Service
public class ZhwyChargedataServiceImpl implements IZhwyChargedataService 
{
    @Autowired
    private ZhwyChargedataMapper zhwyChargedataMapper;
    @Autowired
    private com.ruoyi.mapper.ZhwyChargeitemMapper zhwyChargeitemMapper;

    /**
     * 查询收费数据生成
     * 
     * @param id 收费数据生成主键
     * @return 收费数据生成
     */
    @Override
    public ZhwyChargedata selectZhwyChargedataById(Long id)
    {
        return zhwyChargedataMapper.selectZhwyChargedataById(id);
    }

    /**
     * 查询收费数据生成列表
     * 
     * @param zhwyChargedata 收费数据生成
     * @return 收费数据生成
     */
    @Override
    public List<ZhwyChargedata> selectZhwyChargedataList(ZhwyChargedata zhwyChargedata) {
        List<ZhwyChargedata> list = zhwyChargedataMapper.selectZhwyChargedataList(zhwyChargedata);
        for(ZhwyChargedata zg : list){
            ZhwyChargeitem zhwyChargeitems = zhwyChargeitemMapper.selectZhwyChargeitemById(zg.getChargeitemId());
            zg.setChargenames(zhwyChargeitems.getName());
        }

        return list;
    }

    /**
     * 新增收费数据生成
     * 
     * @param zhwyChargedata 收费数据生成
     * @return 结果
     */
    @Override
    public int insertZhwyChargedata(ZhwyChargedata zhwyChargedata)
    {
        return zhwyChargedataMapper.insertZhwyChargedata(zhwyChargedata);
    }

    /**
     * 修改收费数据生成
     * 
     * @param zhwyChargedata 收费数据生成
     * @return 结果
     */
    @Override
    public int updateZhwyChargedata(ZhwyChargedata zhwyChargedata)
    {
        return zhwyChargedataMapper.updateZhwyChargedata(zhwyChargedata);
    }

    /**
     * 批量删除收费数据生成
     * 
     * @param ids 需要删除的收费数据生成主键
     * @return 结果
     */
    @Override
    public int deleteZhwyChargedataByIds(Long[] ids)
    {
        return zhwyChargedataMapper.deleteZhwyChargedataByIds(ids);
    }

    /**
     * 删除收费数据生成信息
     * 
     * @param id 收费数据生成主键
     * @return 结果
     */
    @Override
    public int deleteZhwyChargedataById(Long id)
    {
        return zhwyChargedataMapper.deleteZhwyChargedataById(id);
    }





    /**
     * 获取每月的缴纳金额 -- 首页图标展示
     * @param currentTime --当前日期
     * @param beforeSix -- 六个月前
     * @return -- 符合的数据集
     */
    //
    @Override
    public List<ZhwyChargedata> queryZhwyDate(String currentTime, String beforeSix) {
        return zhwyChargedataMapper.queryZhwyDate(currentTime, beforeSix);
    }
//
    @Override
    public List<ZhwyChargedata> queryZhwyMonthData(String start, String end) {
        return zhwyChargedataMapper.queryZhwyMonthData(start,end);
    }
}
